import axios from "axios"
const musicModule = {
	namespaced: true,
	state: {
		musicHeading: "Music",
		artists: [],
	},
	getters: {
		reversedMH3: state => state.musicHeading.split("").reverse().join("").repeat(3),
	},
	mutations: {
		SET_ARTISTS(state, data) {
			state.artists = data
		},
		SET_MUSIC_HEADING(state, data) {
			state.musicHeading = data
		},
	},
	actions: {
		async getArtistList({ commit }) {
			const res = await axios.get("https://koo-music.vercel.app/artist/list")
			commit("SET_ARTISTS", res.data.artists)
		},
		updateMHeading(context, options) {
			context.commit("SET_MUSIC_HEADING", options.data)
		}
	}
}

export default musicModule

